/**
 * Project: topdt-jbpm
 * Copyright 2013  Top Digital Technology  Co. Ltd.
 * All right reserved.
 */
package com.topdt.jbpm.model;

import java.sql.Timestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.GenericGenerator;

/**
 * 建立日期 : 2013-4-15 下午5:57:36<br>
 * 作者 : balance<br>
 * 模块 : <br>
 * 描述 : <br>
 * 修改历史: 序号 日期 修改人 修改原因 <br>
 * 1 <br>
 * 2 <br>
 */
@Entity
@Table(name = "wf_work")
public class Work extends JbpmModel {

	private static final long serialVersionUID = -8617517034270047246L;
	public static final String STATE_START = "start";
	public static final String STATE_RUN = "running";
	public static final String STATE_END = "end";
	public static final String STATE_DELETE = "delete";

	@Id
	@GeneratedValue(generator = "generator")
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Column(length = 32)
	private String workId;
	private String appId;
	private Timestamp startTime;
	private Timestamp endTime;
	private String workState;
	private String starter;
	private String starterName;
	private String workTitle;
	private String curActivityName;// 当前环节
	private String appName;
	private String flowId;// 工作流转时使用流程的id
	private String flowKey;// 工作流转时使用流程的key
	private String seqNum;
	@Transient
	private String startDeptId; //发起部门ID
	@Transient
	private String startDeptName; //发起部门名称
	@Transient
	private String firstTime; //高级搜索时候日期段的开始日期
	@Transient
	private String lastTime; //高级搜索时候日期段的结束日期
	@Transient
	String perIds;//查询人员范围id字符串，以,号隔开
	@Transient
	String workType;//工单（ticket）公文（document）
	
	private String isDelete;
	

	public String getPerIds() {
		return perIds;
	}

	public void setPerIds(String perIds) {
		this.perIds = perIds;
	}

	public String getFlowId() {
		return flowId;
	}
//	@Column(name="flow_id")
	public void setFlowId(String flowId) {
		this.flowId = flowId;
	}

	public String getFlowKey() {
		return flowKey;
	}
//	@Column(name="flow_key")
	public void setFlowKey(String flowKey) {
		this.flowKey = flowKey;
	}

	public String getCurActivityName() {
		return curActivityName;
	}
//	@Column(name="cur_activity_name")
	public void setCurActivityName(String curActivityName) {
		this.curActivityName = curActivityName;
	}

	public String getStarterName() {
		return starterName;
	}
//	@Column(name="starter_name")
	public void setStarterName(String starterName) {
		this.starterName = starterName;
	}

	public String getWorkTitle() {
		return workTitle;
	}
//	@Column(name="work_title")
	public void setWorkTitle(String workTitle) {
		this.workTitle = workTitle;
	}

	public String getStarter() {
		return starter;
	}
//	@Column(name="starter")
	public void setStarter(String starter) {
		this.starter = starter;
	}



	public Timestamp getStartTime() {
		return startTime;
	}

	public void setStartTime(Timestamp startTime) {
		this.startTime = startTime;
	}

	public Timestamp getEndTime() {
		return endTime;
	}

	public void setEndTime(Timestamp endTime) {
		this.endTime = endTime;
	}

	public String getWorkState() {
		return workState;
	}
//	@Column(name="work_state")
	public void setWorkState(String workState) {
		this.workState = workState;
	}

	public String getWorkId() {
		return workId;
	}
	
	public void setWorkId(String workId) {
		this.workId = workId;
	}

	public String getAppId() {
		return appId;
	}
//	@Column(name="app_id")
	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getAppName() {
		return appName;
	}

//	@Column(name="app_name")
	public void setAppName(String appName) {
		this.appName = appName;
	}

	public String getStartDeptId() {
		return startDeptId;
	}

	public void setStartDeptId(String startDeptId) {
		this.startDeptId = startDeptId;
	}

	public String getStartDeptName() {
		return startDeptName;
	}

	public void setStartDeptName(String startDeptName) {
		this.startDeptName = startDeptName;
	}
	public String getFirstTime() {
		return firstTime;
	}

	public void setFirstTime(String firstTime) {
		this.firstTime = firstTime;
	}

	public String getLastTime() {
		return lastTime;
	}

	public void setLastTime(String lastTime) {
		this.lastTime = lastTime;
	}

	public String getSeqNum() {
		return seqNum;
	}

//	@Column(name="seq_num")
	public void setSeqNum(String seqNum) {
		this.seqNum = seqNum;
	}

	public String getIsDelete() {
		return isDelete;
	}

//	@Column(name="is_delete")
	public void setIsDelete(String isDelete) {
		this.isDelete = isDelete;
	}
	
	public boolean isFreeFlow() {
		if ((this.flowId == null || "".equals(this.flowId)) && (this.flowKey == null || "".equals(this.flowKey))) {
			return true;
		}
		return false;
	}

	public String getWorkType() {
		return workType;
	}

	public void setWorkType(String workType) {
		this.workType = workType;
	}
}
